﻿#region 命名空间

using System;
using WinnerCMS.Common;
using WinnerCMS.BLL;
using WinnerCMS.Model.Attribute;
using WinnerCMS.Model.Enum;

#endregion

namespace WinnerCMS.WebUI.Admin.Category
{
    [Access("256003")]
    public partial class Move : WebFactory.PageBase
    {
        private readonly CategoryManage _myBll = new CategoryManage();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Bind();
            }
        }

        private void Bind()
        {
            this._myBll.BindDDL(this.lblOldCategory, BindOption.NoLink, null, null);
            this._myBll.BindDDL(this.lblNewCategory, BindOption.NoLink, "作为频道级栏目", null);
        }

        protected void btnMove_Click(object sender, EventArgs e)
        {
            var res = this._myBll.Move(this.lblOldCategory.SelectedValue, this.lblNewCategory.SelectedValue);

            if (string.IsNullOrEmpty(res.Errors))
            {
                Bind();
                MsgBox.Message("操作成功！", this);
            }
            else
            {
                MsgBox.Message(res.Errors, this);
            }
        }
    }
}